[r] Converting unix seconds in milliseconds to POSIXct/POSIXlt

Posted by signalseeker on Stack Overflow See other posts from Stack Overflow or by signalseeker
Published on 2010-03-16T18:40:15Z Indexed on 2010/03/16 18:41 UTC
Read the original article Hit count: 261

Filed under:
|
|

Why do I see a difference when I convert a unix timestamp to datetime object in R?

> as.POSIXlt(1268736919, origin="1970-01-01", tz="America/New_York")
[1] "2010-03-16 06:55:19 EDT"

> as.POSIXct(1268736919, origin="1970-01-01", tz="America/New_York")
[1] "2010-03-16 11:55:19 EDT"

The result from POSIXlt is actually correct.

Also, is there a way to do this conversion without specifying the origin?

Thanks

© Stack Overflow or respective owner

Related posts about r

    Related posts about datetime